package cs235.avl;

import java.util.ArrayList;
import java.util.List;


public abstract class TreeSet<T extends Comparable<T>> extends NotImplemented<T> {

    @Override
    public boolean isEmpty() {
        return size() == 0;
    }

    private List<Object> tempArray;
    
    @Override
    public Object[] toArray() {
        tempArray = new ArrayList<Object>();
        fillList(getRootNode());
        return tempArray.toArray();
    }

    
    public void fillList(BinaryTreeNode node){
        if (node != null){
            tempArray.add(node.getData());
            fillList(node.getLeftChild());
            fillList(node.getRightChild());
        }
    }

}
